<template>
  <!--试验记录进度-->
  <div class="app-container" v-dialog-drag>
    <el-dialog title="进度" :visible.sync="dialogVisible" align="center">
      <el-steps :active="activeStep" align-center>
        <el-step v-for="item in processList" :title="item.title" :description="item.time" :key="item.title"></el-step>
      </el-steps>
    </el-dialog>

  </div>
</template>

<script>
import { progre } from '@/api/maintain'

export default {
  name: 'inspectionTaskProcess',
  data() {
    return {
        dialogVisible: false,
        activeStep: 0,
        processList: [{
            title: '派单',
            status: 1,
            time: ''
        },{
            title: '接收',
            status: 2,
            time: ''
        },{
            title: '完成',
            status: 3,
            time: ''
        },{
            title: '确认',
            status: 4,
            time: ''
        },]
    }
  },
  methods: {
      // 打开弹窗
    open(row) {
      // 修改打开弹窗的变量为true，就可以打开弹窗了
      this.dialogVisible = true;
      // 设置进度
      this.activeStep = row.task_status;
      // 调接口，获取详细数据
      const data = {
        task_num: row.work_num
      }
      // 派单时间
      this.processList[0].time = row.created_at;
      progre(data).then(res => {
        //   debugger
        let dataList = res.data.list;
        this.processList.forEach(ele => {
          dataList.forEach(ele1 => {
              if(ele.title == ele1.task_status) {
                  ele.time = ele1.created_at;
              }
          })
        });
      });
    }
  }
}

</script>

<style scoped>

</style>
